package com.donfu.system.service.house.impl;

import java.util.Date;
import java.util.List;

import com.donfu.system.domain.house.HouseUserVip;
import com.donfu.system.service.house.IHouseUserVipService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.donfu.system.mapper.house.HouseUserVipMapper;

/**
 * 会员Service业务层处理
 * 
 * @author donfu
 * @date 2021-12-09
 */
@Service
public class HouseUserVipServiceImpl implements IHouseUserVipService
{
    @Autowired
    private HouseUserVipMapper houseUserVipMapper;

    /**
     * 查询会员
     * 
     * @param id 会员主键
     * @return 会员
     */
    @Override
    public HouseUserVip selectHouseUserVipById(Long id)
    {
        return houseUserVipMapper.selectHouseUserVipById(id);
    }

    /**
     * 查询会员列表
     * 
     * @param houseUserVip 会员
     * @return 会员
     */
    @Override
    public List<HouseUserVip> selectHouseUserVipList(HouseUserVip houseUserVip)
    {
        return houseUserVipMapper.selectHouseUserVipList(houseUserVip);
    }

    /**
     * 新增会员
     * 
     * @param houseUserVip 会员
     * @return 结果
     */
    @Override
    public int insertHouseUserVip(HouseUserVip houseUserVip)
    {
        houseUserVip.setCreateDate(new Date());
        houseUserVip.setIsAllow(0);
        return houseUserVipMapper.insertHouseUserVip(houseUserVip);
    }

    /**
     * 修改会员
     * 
     * @param houseUserVip 会员
     * @return 结果
     */
    @Override
    public int updateHouseUserVip(HouseUserVip houseUserVip)
    {
        return houseUserVipMapper.updateHouseUserVip(houseUserVip);
    }

    /**
     * 批量删除会员
     * 
     * @param ids 需要删除的会员主键
     * @return 结果
     */
    @Override
    public int deleteHouseUserVipByIds(Long[] ids)
    {
        return houseUserVipMapper.deleteHouseUserVipByIds(ids);
    }

    /**
     * 删除会员信息
     * 
     * @param id 会员主键
     * @return 结果
     */
    @Override
    public int deleteHouseUserVipById(Long id)
    {
        return houseUserVipMapper.deleteHouseUserVipById(id);
    }

    /**
     * 根据会员id和用户id删除会员信息
     * @param id
     * @param userId
     * @return
     */
    @Override
    public int deleteHouseUserVipByIdAndUserId(Long id, Long userId) {
        return houseUserVipMapper.deleteHouseUserVipByIdAndUserId(id,userId);
    }
}
